const { defineConfig } = require('@vue/cli-service')
// const bodyParser = require('body-parser')
const Mock = require('mockjs')
const data = Mock.mock({
  'list|6': [{
    'title': "@ctitle(2)",
    'children|6': [{
        id: "@id",
        img: '@image(40x40,@color)',
        titlee: '@ctitle',

    }]
  }]
})
module.exports = defineConfig({
  transpileDependencies: true,
  lintOnSave:false,
  devServer: {
    onAfterSetupMiddleware: function ({app}) {
      app.get('/list',(req,res)=>{
        res.send(data.list)
      })
      // app.post('/detail',(req,res)=>{
      //   const {id,active} = req.body
      //   let detailList = {}
      //   detailList = data.list[active].children.find((item)=>{
      //     return item.id == id
      //   })

      //   res.send(detailList)
      // })
    },
  },
})
